<template>
  <div class="participants-container">
    <h3 class="section-title">
      参与人员 <span class="count">({{ participants.length }}人)</span>
    </h3>
    
    <div v-if="participants.length > 0" class="participants-list">
      <div 
        v-for="participant in participants" 
        :key="participant.id"
        class="participant-item"
      >
        <el-avatar 
          :size="40" 
          :src="participant.avatar"
          class="participant-avatar"
        >{{ participant.username?.charAt(0).toUpperCase() }}</el-avatar>
        <span class="participant-name">{{ participant.username }}</span>
      </div>
    </div>
    
    <el-empty v-else description="暂无参与人员" />
  </div>
</template>

<script setup>
import { defineProps } from 'vue'

const props = defineProps({
  participants: {
    type: Array,
    default: () => []
  }
})
</script>

<style scoped>
.participants-container {
  margin-top: 20px;
}

.section-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
}

.count {
  font-size: 14px;
  color: var(--text-secondary);
  margin-left: 8px;
  font-weight: normal;
}

.participants-list {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 12px;
}

.participant-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 70px;
  cursor: pointer;
  transition: transform 0.2s;
}

.participant-item:hover {
  transform: translateY(-3px);
}

.participant-avatar {
  margin-bottom: 8px;
  border: 2px solid transparent;
}

.participant-item:hover .participant-avatar {
  border-color: var(--primary-color);
}

.participant-name {
  font-size: 12px;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 100%;
  text-align: center;
}
</style> 